home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- SSSSYYYYNNNNCCCC((((3333CCCC)))) SSSSYYYYNNNNCCCC((((3333CCCC))))
-
-
-
- NNNNAAAAMMMMEEEE
- sync: __synchronize, __fetch_and_add, __fetch_and_sub, __fetch_and_or,
- __fetch_and_and, __fetch_and_xor, __fetch_and_nand, __add_and_fetch,
- __sub_and_fetch, __or_and_fetch, __and_and_fetch, __xor_and_fetch,
- __nand_and_fetch, __lock_test_and_set, __lock_release- C synchronization
- primitives for multiprocessing
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- See summaries below
-
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- The intrinsics described here provide a variety of primitive
- synchronization operations. Besides performing the particular
- synchronization operation, each of these intrinsics has two key
- properties:
-
- The function performed is guaranteed to be atomic (typically achieved
- by implementing the operation using a sequence of load-linked/store-
- conditional instructions in a loop).
-
- Associated with each instrinsic are certain _m_e_m_o_r_y _b_a_r_r_i_e_r properties
- that restrict the movement of memory references to _v_i_s_i_b_l_e _d_a_t_a
- across the intrinsic operation (by either the compiler or the
- processor).
-
- A visible memory reference is a reference to a data object
- potentially accessible by another thread executing in the same shared
- address space. A visible data object may be one of the following:
-
- C/C++ global data
-
- Fortran COMMON data
-
- data declared _e_x_t_e_r_n
-
- volatile data
-
- static data (either file-scope or function-scope)
-
- data accessible via function parameters
-
- automatic data (local-scope) that has had its address taken and
- assigned to some object which is visible (recursively).
-
-
- The memory barrier semantics of an intrinsic may be one of the
- following three types:
-
- aaaaccccqqqquuuuiiiirrrreeee bbbbaaaarrrrrrrriiiieeeerrrr
-
- Disallows the movement of memory references to visible data from
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- SSSSYYYYNNNNCCCC((((3333CCCC)))) SSSSYYYYNNNNCCCC((((3333CCCC))))
-
-
-
- after the intrinsic (in program order) to before the intrinsic
- (this behavior is desirable at lock-acquire operations, hence the
- name).
-
-
- rrrreeeelllleeeeaaaasssseeee bbbbaaaarrrrrrrriiiieeeerrrr
-
- Disallows the movement of memory references to visible data from
- before the intrinsic (in program order) to after the intrinsic
- (this behavior is desirable at lock-release operations, hence the
- name).
-
- ffffuuuullllllll bbbbaaaarrrrrrrriiiieeeerrrr
-
- disallows the movement of memory references to visible data past
- the intrinsic (in either direction), and is thus both an acquire
- and a release barrier. A barrier only restricts the movement of
- memory references to visible data across the intrinsic operation:
- between synchronization operations (or in their absence), memory
- references to visible data may be freely reordered subject to the
- usual data-dependence constraints.
-
- CCCCaaaauuuuttttiiiioooonnnn:::: Conditional execution of a synchronization intrinsic (such as
- within a _i_f or a _w_h_i_l_e statement) does not prevent the movement of memory
- references to visible data past the overall _i_f or _w_h_i_l_e construct.
-
-
- AAAAttttoooommmmiiiicccc ffffeeeettttcccchhhh----aaaannnndddd----oooopppp OOOOppppeeeerrrraaaattttiiiioooonnnnssss
-
- ttttyyyyppppeeee ________ffffeeeettttcccchhhh____aaaannnndddd____aaaadddddddd ((((ttttyyyyppppeeee**** ppppttttrrrr,,,, ttttyyyyppppeeee vvvvaaaalllluuuueeee,,,, ............))))
-
- ttttyyyyppppeeee ________ffffeeeettttcccchhhh____aaaannnndddd____ssssuuuubbbb ((((ttttyyyyppppeeee**** ppppttttrrrr,,,, ttttyyyyppppeeee vvvvaaaalllluuuueeee,,,, ............))))
-
- ttttyyyyppppeeee ________ffffeeeettttcccchhhh____aaaannnndddd____oooorrrr ((((ttttyyyyppppeeee**** ppppttttrrrr,,,, ttttyyyyppppeeee vvvvaaaalllluuuueeee,,,, ............))))
-
- ttttyyyyppppeeee ________ffffeeeettttcccchhhh____aaaannnndddd____aaaannnndddd ((((ttttyyyyppppeeee**** ppppttttrrrr,,,, ttttyyyyppppeeee vvvvaaaalllluuuueeee,,,, ............))))
-
- ttttyyyyppppeeee ________ffffeeeettttcccchhhh____aaaannnndddd____xxxxoooorrrr ((((ttttyyyyppppeeee**** ppppttttrrrr,,,, ttttyyyyppppeeee vvvvaaaalllluuuueeee,,,, ............))))
-
- ttttyyyyppppeeee ________ffffeeeettttcccchhhh____aaaannnndddd____nnnnaaaannnndddd((((ttttyyyyppppeeee**** ppppttttrrrr,,,, ttttyyyyppppeeee vvvvaaaalllluuuueeee,,,, ............))))
-
- Where ttttyyyyppppeeee may be one of _i_n_t, _l_o_n_g, _l_o_n_g _l_o_n_g, _u_n_s_i_g_n_e_d _i_n_t, _u_n_s_i_g_n_e_d
- _l_o_n_g, or _u_n_s_i_g_n_e_d _l_o_n_g _l_o_n_g.
- The ellipses (...) refers to an optional list of variables protected
- by the memory barrier.
-
- Behavior:
-
- Atomically performs the specified operation with the given value
- on *ptr, and returns the old value of *ptr. (i.e.)
-
- { tmp = *ptr; *ptr <op>= value; return tmp; }
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-
-
-
- SSSSYYYYNNNNCCCC((((3333CCCC)))) SSSSYYYYNNNNCCCC((((3333CCCC))))
-
-
-
- Full barrier.
-
-
-
- AAAAttttoooommmmiiiicccc oooopppp----aaaannnndddd----ffffeeeettttcccchhhh OOOOppppeeeerrrraaaattttiiiioooonnnnssss
-
- ttttyyyyppppeeee ________aaaadddddddd____aaaannnndddd____ffffeeeettttcccchhhh ((((ttttyyyyppppeeee**** ppppttttrrrr,,,, ttttyyyyppppeeee vvvvaaaalllluuuueeee,,,, ............))))
-
- ttttyyyyppppeeee ________ssssuuuubbbb____aaaannnndddd____ffffeeeettttcccchhhh ((((ttttyyyyppppeeee**** ppppttttrrrr,,,, ttttyyyyppppeeee vvvvaaaalllluuuueeee,,,, ............))))
-
- ttttyyyyppppeeee ________oooorrrr____aaaannnndddd____ffffeeeettttcccchhhh ((((ttttyyyyppppeeee**** ppppttttrrrr,,,, ttttyyyyppppeeee vvvvaaaalllluuuueeee,,,, ............))))
-
- ttttyyyyppppeeee ________aaaannnndddd____aaaannnndddd____ffffeeeettttcccchhhh ((((ttttyyyyppppeeee**** ppppttttrrrr,,,, ttttyyyyppppeeee vvvvaaaalllluuuueeee,,,, ............))))
-
- ttttyyyyppppeeee ________xxxxoooorrrr____aaaannnndddd____ffffeeeettttcccchhhh ((((ttttyyyyppppeeee**** ppppttttrrrr,,,, ttttyyyyppppeeee vvvvaaaalllluuuueeee,,,, ............))))
-
- ttttyyyyppppeeee ________nnnnaaaannnndddd____aaaannnndddd____ffffeeeettttcccchhhh((((ttttyyyyppppeeee**** ppppttttrrrr,,,, ttttyyyyppppeeee vvvvaaaalllluuuueeee,,,, ............))))
-
- Where ttttyyyyppppeeee may be one of _i_n_t, _l_o_n_g, _l_o_n_g _l_o_n_g, _u_n_s_i_g_n_e_d _i_n_t, _u_n_s_i_g_n_e_d
- _l_o_n_g, or _u_n_s_i_g_n_e_d _l_o_n_g _l_o_n_g. The ellipses (...) refers to an optional
- list of variables protected by the memory barrier.
-
- Behavior:
-
- Atomically performs the specified operation with the given value
- on *ptr, and returns the new value of *ptr. (i.e.)
-
- { *ptr <op>= value; return *ptr; }
-
- Full barrier.
-
-
- AAAAttttoooommmmiiiicccc ccccoooommmmppppaaaarrrreeee----aaaannnndddd----sssswwwwaaaapppp OOOOppppeeeerrrraaaattttiiiioooonnnn
-
- iiiinnnntttt ________ccccoooommmmppppaaaarrrreeee____aaaannnndddd____sssswwwwaaaapppp ((((ttttyyyyppppeeee**** ppppttttrrrr,,,, ttttyyyyppppeeee oooollllddddvvvvaaaalllluuuueeee,,,, ttttyyyyppppeeee nnnneeeewwwwvvvvaaaalllluuuueeee,,,, ............))))
-
- Where ttttyyyyppppeeee may be one of _i_n_t, _l_o_n_g, _l_o_n_g _l_o_n_g, _u_n_s_i_g_n_e_d _i_n_t, _u_n_s_i_g_n_e_d
- _l_o_n_g, or _u_n_s_i_g_n_e_d _l_o_n_g _l_o_n_g. The ellipses (...) refers to an optional
- list of variables protected by the memory barrier.
-
- Behavior:
-
- Atomically do the following: compare *ptr to oldvalue. If equal,
- store the new value and return 1, otherwise return 0. (i.e.)
-
- if (*ptr != oldvalue) return 0;
-
- else {
-
- *ptr = newvalue;
-
- return 1; }
-
-
-
- PPPPaaaaggggeeee 4444
-
-
-
-
-
-
- SSSSYYYYNNNNCCCC((((3333CCCC)))) SSSSYYYYNNNNCCCC((((3333CCCC))))
-
-
-
- Full barrier.
-
-
-
- AAAAttttoooommmmiiiicccc ssssyyyynnnncccchhhhrrrroooonnnniiiizzzzeeee OOOOppppeeeerrrraaaattttiiiioooonnnn
-
- ________ssssyyyynnnncccchhhhrrrroooonnnniiiizzzzeeee ((((............))))
-
- The ellipses (...) refers to an optional list of variables protected by
- the memory barrier.
-
- Behavior:
- Full barrier
-
-
-
- AAAAttttoooommmmiiiicccc lllloooocccckkkk----tttteeeesssstttt----aaaannnndddd----sssseeeetttt OOOOppppeeeerrrraaaattttiiiioooonnnn
-
- ttttyyyyppppeeee ________lllloooocccckkkk____tttteeeesssstttt____aaaannnndddd____sssseeeetttt ((((ttttyyyyppppeeee**** ppppttttrrrr,,,, ttttyyyyppppeeee vvvvaaaalllluuuueeee,,,, ............))))
-
- Where ttttyyyyppppeeee may be one of _i_n_t, _l_o_n_g, _l_o_n_g _l_o_n_g, _u_n_s_i_g_n_e_d _i_n_t, _u_n_s_i_g_n_e_d
- _l_o_n_g, or _u_n_s_i_g_n_e_d _l_o_n_g _l_o_n_g. The ellipses (...) refers to an optional
- list of variables protected by the memory barrier.
-
- Behavior
-
- Atomically store the supplied value in *ptr and return the old
- value of *ptr. (i.e.)
-
- { tmp = *ptr; *ptr = value; return tmp; }
-
- Acquire barrier
-
-
- AAAAttttoooommmmiiiicccc lllloooocccckkkk____rrrreeeelllleeeeaaaasssseeee OOOOppppeeeerrrraaaattttiiiioooonnnn
-
- vvvvooooiiiidddd ________lllloooocccckkkk____rrrreeeelllleeeeaaaasssseeee ((((ttttyyyyppppeeee**** ppppttttrrrr,,,, ............))))
-
- Where ttttyyyyppppeeee may be one of _i_n_t, _l_o_n_g, _l_o_n_g _l_o_n_g, _u_n_s_i_g_n_e_d _i_n_t, _u_n_s_i_g_n_e_d
- _l_o_n_g, or _u_n_s_i_g_n_e_d _l_o_n_g _l_o_n_g. The ellipses (...) refers to an optional
- list of variables protected by the memory barrier.
-
- Behavior:
-
- Set *ptr to 0. (i.e.) { *ptr = 0 }
-
- Release barrier
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 5555
-
-
-
-